package com.front.teacher.teacherapp.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.front.teacher.teacherapp.R;


public class ActivityTools {
	
	public static void goNextActivity(Context context, Class clazz){
		Intent intent = new Intent(context, clazz);
		context.startActivity(intent);
		((Activity)context).overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
	}

	public static void goNextActivity(Fragment fragment, Class clazz) {
		Intent intent = new Intent(fragment.getActivity(), clazz);
		fragment.startActivity(intent);
		fragment.getParentFragment().startActivity(intent);
		((Activity) fragment.getActivity()).overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
	}

	public static void goNextActivityForResult(Fragment fragment, Class clazz, Bundle bundle, int requestCode) {
		Intent intent = new Intent(fragment.getActivity(), clazz);
		if (bundle != null) {
			intent.putExtras(bundle);
		}
		fragment.startActivityForResult(intent, requestCode);
		fragment.getActivity().overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
	}
	
	public static void goNextActivity(Context context, Class clazz, Bundle bundle){
		Intent intent = new Intent(context, clazz);
		if (bundle != null) {
			intent.putExtras(bundle);
		}
		context.startActivity(intent);
		((Activity)context).overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
	}
	public static void goNextActivityForResult(Context context, Class clazz, Bundle bundle, int requestCode){
		Intent intent = new Intent(context, clazz);
		if (bundle != null) {
			intent.putExtras(bundle);
		}
		((Activity)context).startActivityForResult(intent, requestCode);
		((Activity)context).overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
	}
}
